///////////////////////////////////////////////////////////////////////////////////////////////////
// Illusion Ray Development Kit (IDK)           Copyright (c) 2010 ( dimitriy.martynenko@gmail.com )
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2010-05-22
// Updated : ...
// Licence : NEW BSD
// Info	   : IDK Engine
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once

namespace Renderer
{
	//
	class TRenderState : public TObject, virtual public IDK::IRenderState
	{
		IDKClass;
	protected:
		//
		ref<IDK::IOcclusionQuery> mOccluder;
		//state
		CullFace::Enum mCullFace;
		Blend::Enum mBlend;
		DepthTest::Enum mDepthTest;
		//matrix
		Set<MatrixType::Enum> mMatricesChanged;
		Math::Matrix44 mMatrices[MatrixType::MAX];
		IDK::GPUShader mBindShader;
		IDK::GPUTexture mBindTextures[TextureBinding::MAX];
		IDK::GPURenderTarget mBindRenderTarget;

		IDK::GPUIndexBuffer mBindIndexBuffer;
		IDK::GPUVertexBuffer mBindVertexBuffer;

		//Vertex input binding
		IDK::GPUVertexBinding mVertexBinding;

		typedef Array<IDK::GPUResource> Resources;
		Resources mResources;

		float mTimeFrame;
		float mTimeElapsed;
	protected:
		TRenderState(void);
	public:
		void Swap(float dt);
	public:
		virtual ref<IDK::IOcclusionQuery> GetOcclusionQuery(void);
		virtual void SetMatrix(MatrixType::Enum type, const Math::Matrix44& m);
		virtual void Reset();
	};

	typedef ref<TRenderState> RenderState;
}